<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑银行卡信息</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
    <h2 class="mb-4">编辑银行卡信息</h2>
    <form th:action="@{/admin/card/update}" method="post">
        <!-- 卡号为只读 -->
        <div class="form-group">
            <label for="cardId">卡号</label>
            <input type="text" id="cardId" name="cardId" class="form-control" th:value="${card.cardId}" readonly>
        </div>

<!--        <div class="form-group">-->
<!--            <label for="customerId">客户编号</label>-->
<!--            <input type="number" id="customerId" name="customerId" class="form-control" th:value="${card.customerId}" required>-->
<!--        </div>-->


        <div class="form-group">
            <label for="customerId">开户客户</label>
            <select class="form-control" id="customerId" name="customerId" required>
                <option value="">请选择客户</option>
                <th:block th:each="user : ${userList}">
                    <option th:value="${user.customerId}"
                            th:text="${user.name}"
                            th:selected="${user.customerId == card.customerId}">
                    </option>
                </th:block>
            </select>
        </div>

        <div class="form-group">
            <label for="curId">币种</label>
            <input type="text" id="curId" name="curId" class="form-control" th:value="${card.curId}" readonly>
        </div>

        <div class="form-group">
            <label for="openMoney">开户金额</label>
            <input type="number" step="0.01" id="openMoney" name="openMoney" class="form-control" th:value="${card.openMoney}" required>
        </div>

        <div class="form-group">
            <label for="balance">账户余额</label>
            <input type="number" step="0.01" id="balance" name="balance" class="form-control" th:value="${card.balance}" required>
        </div>

        <div class="form-group">
            <label for="openDate">开户日期</label>
            <input type="date" id="openDate" name="openDate" class="form-control"
                   th:value="${openDateStr}" required>

        </div>

        <div class="form-group">
            <label for="pass">密码</label>
            <input type="password" id="pass" name="pass" class="form-control" th:value="${card.pass}" required>
        </div>

        <div class="form-group">
            <label for="isReportLoss">是否挂失</label>
            <select id="isReportLoss" name="isReportLoss" class="form-control">
                <option th:selected="${card.isReportLoss} == 0" value="0">否</option>
                <option th:selected="${card.isReportLoss} == 1" value="1">是</option>
            </select>
        </div>

        <div class="form-group">
            <label for="savingId">存款类型</label>
            <select id="savingId" name="savingId" class="form-control">
                <option th:each="type : ${depositTypes}"
                        th:value="${type.savingId}"
                        th:text="${type.savingName}"
                        th:selected="${card.savingId} == ${type.savingId}">存款类型</option>
            </select>
        </div>

        <button type="submit" class="btn btn-success">保存修改</button>
        <a th:href="@{/admin/card/list}" class="btn btn-secondary ml-2">取消</a >
    </form>
</div>
</body>
</html>